Inside Macintosh: QuickTime

Previous | Chapter Top | Chapter Contents | Next

Making Thumbnail Pictures

This section describes the functions that allow your application to create thumbnail pictures from existing images that are stored as pixel maps, pictures, or picture files. Thumbnail pictures are useful for creating small, representative images of a source image. You can use thumbnails when you create previews for files that contain image data (for more information about file previews, see the chapter "Movie Toolbox" in this book).

You can create thumbnails from pictures, picture files, or pixel maps--use the MakeThumbnailFromPicture , MakeThumbnailFromPictureFile , or MakeThumbnailFromPixMap function, as appropriate.

MakeThumbnailFromPicture

The MakeThumbnailFromPicture function creates an 80-by-80 pixel thumbnail picture from a specified picture structure.

pascal OSErr MakeThumbnailFromPicture (PicHandle picture,
                                         short colorDepth,
                                         PicHandle thumbnail,
                                         ICMProgressProcRecordPtr progressProc);
picture
Contains a handle to the image from which the thumbnail is to be extracted. The image must be stored in a picture structure.
colorDepth
Specifies the depth at which the image is likely to be viewed. If you set this parameter to 0, the Image Compression Manager determines the appropriate value for the source image. Values of 1, 2, 4, 8, 16, 24, and 32 indicate the number of bits per pixel for color images. Values of 34, 36, and 40 indicate 2-bit, 4-bit, and 8-bit grayscale, respectively, for grayscale images.
thumbnail
Contains a handle to the destination picture structure for the thumbnail image. The compressor resizes this handle for the resulting data.
progressProc
Points to a progress function structure. During the operation, the Image Compression Manager will occasionally call a function you provide in order to report its progress (see "Progress Functions," for more information about progress functions). If you have not provided a progress function, set this parameter to nil . If you pass a value of -1, you obtain a standard progress function.

RESULT CODES

noErr

0

No error

paramErr

-50

Invalid parameter specified

memFullErr

-108

Not enough memory available

codecAbortErr

-8967

Operation aborted by the progress function

MakeThumbnailFromPictureFile

The MakeThumbnailFromPictureFile function creates an 80-by-80 pixel thumbnail picture from a specified picture file (PICT file).

pascal OSErr MakeThumbnailFromPictureFile (short refNum,
                                         short colorDepth,
                                         PicHandle thumbnail,
                                         ICMProgressProcRecordPtr progressProc);
refNum
Contains a file reference number for the PICT file from which the thumbnail is to be extracted.
colorDepth
Specifies the depth at which the image is likely to be viewed. If you set this parameter to 0, the Image Compression Manager determines the appropriate value for the source image. Values of 1, 2, 4, 8, 16, 24, and 32 indicate the number of bits per pixel for color images. Values of 34, 36, and 40 indicate 2-bit, 4-bit, and 8-bit grayscale, respectively, for grayscale images.
thumbnail
Contains a handle to the destination picture structure for the thumbnail image. The compressor resizes this handle for the resulting data.
progressProc
Points to a progress function structure. During the operation, the Image Compression Manager will occasionally call a function you provide in order to report its progress (see "Progress Functions," for more information about progress functions). If you have not provided a progress function, set this parameter to nil . If you pass a value of -1, you obtain a standard progress function.

RESULT CODES

noErr

0

No error

paramErr

-50

Invalid parameter specified

memFullErr

-108

Not enough memory available

codecAbortErr

-8967

Operation aborted by the progress function

File Manager errors

MakeThumbnailFromPixMap

The MakeThumbnailFromPixMap function creates an 80-by-80 pixel thumbnail picture from a specified pixel map structure.

pascal OSErr MakeThumbnailFromPixMap (PixMapHandle src,
                                         const Rect *srcRect,
                                         short colorDepth,
                                         PicHandle thumbnail,
                                         ICMProgressProcRecordPtr progressProc);
src
Contains a handle to the image from which the thumbnail is to be extracted. The image must be stored in a pixel map structure.
srcRect
Contains a pointer to a rectangle defining the portion of the image to use for the thumbnail.
colorDepth
Specifies the depth at which the image is likely to be viewed. If you set this parameter to 0, the Image Compression Manager determines the appropriate value for the source image. Values of 1, 2, 4, 8, 16, 24, and 32 indicate the number of bits per pixel for color images. Values of 34, 36, and 40 indicate 2-bit, 4-bit, and 8-bit grayscale, respectively, for grayscale images.
thumbnail
Contains a handle to the destination picture structure for the thumbnail image. The compressor resizes this handle for the resulting data.
progressProc
Points to a progress function structure. During the operation, the Image Compression Manager will occasionally call a function you provide in order to report its progress (see "Progress Functions," , for more information about progress functions). This parameter contains a pointer to a structure that identifies that progress function. If you have not provided a progress function, set this parameter to nil . If you pass a value of -1, you obtain a standard progress function.

DESCRIPTION

The thumbnail returned is an 80-by-80 pixel picture, but the aspect ratio is maintained.

RESULT CODES

noErr

0

No error

paramErr

-50

Invalid parameter specified

memFullErr

-108

Not enough memory available

codecAbortErr

-8967

Operation aborted by the progress function


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next